FROM openjdk:8-jre-alpine
MAINTAINER "1142519971@qq.com"
# ENV PARAMS="" jar包运行时的环境变量需要可以自定义
ENV TZ=PRC
ENV JAVA_OPTS="-Dspring.config.location=file:/etc/gateway/conf/application.yml"
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone # 添加时区的概念
# 网关服务默认监听的端口号是8888
EXPOSE 8888
# 添加api-gateway-egine的jar包
ADD target/api-gateway-engine.jar /opt/gateway/api-gateway-engine.jar
ADD src/main/resources/application.yml /etc/gateway/conf/application.yml

# 用户在使用docker run 启动容器时，可以将自定义的application.yml 挂载到 /etc/gateway/conf/application.yml中
ENTRYPOINT ["sh","-c","java -jar $JAVA_OPTS /opt/gateway/api-gateway-engine.jar"]